import { get, post } from '@/utils/request'
import type {
  IArticleListResponse,
  IArticleAddRequest,
} from '@/api/interface/article'

export const queryArticleList = (): Promise<IArticleListResponse[]> => {
  return get('/article/query')
}

export const insertArticle = (data: IArticleAddRequest) => {
  return post('/article/insert', data)
}

export const updateArticle = (data: IArticleAddRequest) => {
  return post('/article/update', data)
}

export const removeArticle = (id: string | number) => {
  return post('/article/remove', { id })
}

// 发布文章
export const publishArticle = (id: number) => {
  return get('/article/published', { id })
}
